/*
 *  Copyright 2009 Lucas Nazário dos Santos
 *  
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *      http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package net.sourceforge.retriever.analyzer;

import java.util.Map;

import net.sourceforge.retriever.fetcher.Resource;

/**
 * <p>
 * Analyzers are used to consume crawled information.
 * </p>
 * 
 * <p>
 * In order to do that, users must give this class an implementation
 * and pass it to the <code>Crawler</code> object using the 
 * <code>addAnalyzer(Analyzer)</code> method.
 * </p>
 * 
 * <p>
 * This way, users will be able to act upon every crawled resource in
 * order to achieve their goals, that could be to persist data into
 * a database or inverted index, to print some information on the console,
 * to log data, and so forth.
 * </p>
 * 
 * <p>A special care must be taken while developing your own <code>Analyzer</code>
 * since each instance is likely to be accessed by multiple threads at the
 * same time.</p>
 * 
 * @see net.sourceforge.retriever.Retriever#addAnalyzer(Analyzer)
 */
public interface Analyzer {


	/**
	 * Operation that let users consume crawled resources.
	 * 
	 * @param resource The resource to be consumed.
	 * @param additionalInfo TODO
	 */
	void analyze(Resource resource, Map<String, Object> additionalInfo);
}